import { createApp } from 'vue'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import 'virtual:svg-icons-register'
import '@/styles/index.scss'
import 'cesium/Build/Cesium/Widgets/widgets.css'


import App from './App.vue'
import router from './router'

import components from '@/components/index'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'


const app = createApp(App)
const pinia = createPinia()

// 全局注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

// 修复Pinia实例和插件应用顺序
pinia.use(piniaPluginPersistedstate)
app.use(pinia)
app.use(router)
app.use(components)
app.use(ElementPlus)

app.mount('#app')
